package com.example.activity;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import com.example.R;

/**
 * Created with IntelliJ IDEA.
 * User: Jasic
 * Date: 12-11-28
 */
public class ShowResourceActivity extends TabActivity {

    TabHost tabHost;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        super.setContentView(R.layout.showresourcelayout);

        // 1、拿到tabHost
        tabHost = (TabHost) findViewById(android.R.id.tabhost);
        tabHost.setup();

        Resources resources = getResources();

        // 2、生成一个tab页面
        Intent remoteIntent = new Intent(this, RemoteResourceActivity.class);
        TabHost.TabSpec tabSpec1 = tabHost.newTabSpec("remote");
        // 设置图标
        tabSpec1.setIndicator("远程资源", resources.getDrawable(android.R.drawable.stat_sys_download));
        // 设置内容
        tabSpec1.setContent(remoteIntent);

        // 3、把tab页面添加到tabHost上
        tabHost.addTab(tabSpec1);


        // 2、生成一个tab页面
        Intent localIntent = new Intent(this, LocalResourceActivity.class);
        TabHost.TabSpec tabSpec2 = tabHost.newTabSpec("remote");
        // 设置图标
        tabSpec2.setIndicator("本地资源", resources.getDrawable(android.R.drawable.stat_sys_upload));
        // 设置内容
        tabSpec2.setContent(localIntent);

        // 3、把tab页面添加到tabHost上
        tabHost.addTab(tabSpec2);


    }
}
